<template>
    <div>
        <div class="enter_exam_tittle">
            <BreadCrumb></BreadCrumb>
        </div>
        <div class="examEnter_tittle">
            期末考试成绩录入
        </div>
        <div class="form_wrap">
            <el-form ref="form" :model="form" label-width="80px">
                <el-form-item label="学号" prop="stu_id">
                    <el-input v-model="form.stu_id"></el-input>
                </el-form-item>
                <el-form-item label="姓名" prop="stu_name">
                    <el-input v-model="form.stu_name"></el-input>
                </el-form-item>
                <el-form-item label="语文" prop="chinese">
                    <el-input v-model="form.chinese"></el-input>
                </el-form-item>
                <el-form-item label="数学" prop="math">
                    <el-input v-model="form.math"></el-input>
                </el-form-item>
                <el-form-item label="英语" prop="english">
                    <el-input v-model="form.english"></el-input>
                </el-form-item>
                <el-form-item label="理综" prop="lizong">
                    <el-input v-model="form.lizong"></el-input>
                </el-form-item>
                <el-form-item label="文综" prop="wenzong">
                    <el-input v-model="form.wenzong"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button type="primary" @click="submitForm">提交</el-button>
                    <el-button @click="resetForm">重置</el-button>
                </el-form-item>
            </el-form>
        </div>
    </div>
</template>

<script>
import { req_end_exam } from '@/api/exam.js'
export default {
    data() {
        return {
            form: {
                stu_id: '',
                stu_name: '',
                chinese: '',
                math: '',
                english: '',
                lizong: '',
                wenzong: ''
            }
        }
    },
    methods: {
        //重置按钮
        resetForm() {
            // console.log('重置')
            this.$refs.form.resetFields();
        },
        //提交按钮
        async submitForm() {
            // console.log(this.form)
            let result = await req_end_exam(this.form)
            console.log(result);

            //设置弹框提示
            this.$message({
                message: "数据提交成功！！",
                type: "success",
                offset: 130,
            });

            //调用重置
            this.resetForm();
        }
    }
}
</script>

<style lang="scss" scoped>
div {

    .enter_exam_tittle,
    .examEnter_tittle {
        height: 30px;
    }

    .examEnter_tittle {
        font-size: 20px;
        font-weight: 700;
        text-align: center;
        margin-bottom: 20px;
    }

    .form_wrap {
        width: 300px;
        margin: 0 auto;
    }
}
</style>